//
//  Dynamic.m
//  SDDataTest
//
//  Created by sodao on 12-9-19.
//  Copyright (c) 2012年 sodao. All rights reserved.
//

#import "Dynamic.h"
static NSMutableDictionary* allObjects;
@implementation Dynamic
@synthesize  dynamicID;
@synthesize  dynamicTime;
@synthesize  updateTime;
@synthesize  dynamicType;

- (void)encodeWithCoder:(NSCoder *)aCoder{
    [super encodeWithCoder:aCoder];
    [aCoder encodeObject:self.dynamicID forKey:PropertyNameDynamicID];
    [aCoder encodeObject:self.dynamicTime forKey:PropertyNameDynamicTime];
    [aCoder encodeObject:self.updateTime forKey:PropertyNameUpdateTime];
    [aCoder encodeInt:self.dynamicType forKey:PropertyNameDynamicType];
}
- (id)initWithCoder:(NSCoder *)decoder {
    if (self = [super init]) {
        self.dynamicID = [decoder decodeObjectForKey:PropertyNameDynamicID];
        self.dynamicTime = [decoder decodeObjectForKey:PropertyNameDynamicTime];
        self.dynamicType = [decoder decodeInt32ForKey:PropertyNameDynamicType];
        self.updateTime = [decoder decodeObjectForKey:PropertyNameUpdateTime];
    }
    return self;
}
-(id)initWithDictionary:(NSDictionary*)dictionary{
    self = [super init];
    if (self) {
        self.dynamicID = [self getFeedIDByObject:[dictionary objectForKey:PropertyNameDynamicID]];
        self.dynamicTime = [self getServerUTC:[[dictionary objectForKey:PropertyNameDynamicTime] longLongValue]];
        self.updateTime = [self getServerUTC:[[dictionary objectForKey:PropertyNameUpdateTime]longLongValue]];
        self.dynamicType = [[dictionary objectForKey:PropertyNameDynamicType] intValue];
    }
    return self;
}
-(void)dealloc{
    [super dealloc];
    [self.dynamicID release];
    [self.dynamicTime release];
    [self.updateTime release];
}
@end
